//
//  SetPassWordController.m
//  ShrimpCrowdordering
//
//  Created by 骆锴 on 2018/8/24.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "SetPassWordController.h"
#import "ResetPassWordController.h"
#import "ForgetPassWordController.h"

@interface SetPassWordController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) BaseTableView *tableView;

@end

@implementation SetPassWordController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"密码设置";
    [self setTableView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)setTableView{
    self.tableView = [[BaseTableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - NAVIGATION_BAR_HEIGHT)];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.backgroundColor = REXADECIMALCOLOR(@"#eeeeee");
    [self.view addSubview:self.tableView];
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellId = @"setCell";
    NSArray *titleValue = [[NSArray alloc] initWithObjects:@"修改登录密码",@"忘记登录密码", nil];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    UILabel *titleLabel =[[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(16), ScreenX375(16), ScreenX375(100), ScreenX375(15))];
    titleLabel.text = [titleValue objectAtIndex:indexPath.row];
    titleLabel.font = Kfont(15);
    titleLabel.textColor = REXADECIMALCOLOR(@"#333333");
    titleLabel.textAlignment = NSTextAlignmentLeft;
    [cell addSubview:titleLabel];
    
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(ScreenX375(24), ScreenX375(47.5), ScreenX375(359), ScreenX375(0.5))];
    line.backgroundColor = LineColor;
    [cell addSubview:line];
    
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return ScreenX375(48);
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        ResetPassWordController *vc = [[ResetPassWordController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.row == 1){
        ForgetPassWordController *vc = [[ForgetPassWordController alloc] init];
        vc.phone = self.phone;
        [self.navigationController pushViewController:vc animated:YES];
    }
}

@end
